package com.whf.android.jar.constants;


import com.whf.android.jar.net.HttpCode;

import java.io.Serializable;

/**
 * 请求结果封装类
 *
 * @author : qf.
 * @author wang.hai.fang
 * @since 2.5.0
 */

public final class BaseEntries<T> implements Serializable {

    /**
     * 结果
     */
    private int code;
    /**
     * 分页时用数据条数
     */
    private int count;
    /**
     * 消息
     */
    private String message;
    /**
     * 消息
     */
    private String msg;
    /**
     * 总页数
     */
    private int pageCount;
    /**
     * 总页数
     */
    private int total;

    /**
     * 信息
     */
    private T data;

    /**
     * 构造
     */
    public BaseEntries() {

    }

    /**
     * 数据库取数据
     *
     * @param data:数据
     */
    public BaseEntries(T data) {
        this.code = HttpCode.CODE_200;
        this.message = "成功";
        this.data = data;
    }

    /**
     * 分页请求 请求是否成功(普通请求时)
     *
     * @return true:成功
     */
    public boolean isOk() {
        return HttpCode.CODE_200 == code || 0 == code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }
}
